<template>
  <div class="box">
    <div v-for="(item, index) in goodsList" :key="index" @click="link_goods(item)" class="box-item">
      <div class="box-item-img">
        <img :src="item.cover" width="100%" height="100%" />
      </div>
      <div class="box-item-right">
        <div class="title">
          <span class="tiktok">抖音</span>
          <span>{{item.title}}</span>
        </div>
        <div class="mt37 flex align-items-center">
          <span class="c-FF6238">
            <span class="f24 mr-8">到手价</span>
            <span class="bold mr-16">{{ $i18n.t("money") }}{{item.coupon_price}}</span>
          </span>
          <span class="original-cost">{{ $i18n.t("money") }}{{item.price}}</span>
        </div>
        <div class="flex between mt-22">
          <div class="buy">{{item.sales}}</div>
          <div class="make-money"   v-if="item.share_rewards">
            <span class="p-4 fs-10 line" >赚</span>
            <span class="p-4 fs-10">{{item.share_reward}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    goodsList: {
      default: () => []
    }
  },
  data() {
    return {};
  },
  methods: {
    link_goods({ product_id }) {
      this.$router.push(this.fun.getUrl("TikTokDetail", {id: product_id  }, {}));
    }
  }
};
</script>

<style scoped lang="scss">
.box {
  background: #fff;
  padding: 0 0.75rem;

  .top {
    position: absolute;
    top: 0;
    left: -1px;
    width: 1.6rem;
    height: 1.8rem;
  }

  .mt-22 {
    margin-top: 0.6875rem;
  }

  .mt37 {
    margin-top: 1.1563rem;
  }

  .fz-16 {
    font-size: 0.5rem;
  }

  .flex {
    display: flex;
  }

  .between {
    justify-content: space-between;
  }

  .align-items-center {
    align-items: center;
  }

  .title {
    text-align: left;
    // width: 100%;
    // overflow: hidden;
    // white-space: nowrap;
    // text-overflow: ellipsis;
  }

  .tiktok {
    background-color: #000;
    color: #fff;
    border-radius: 0.3125rem;
    padding: 0.0938rem 0.25rem;
    font-size: 0.75rem;
    margin-right: 0.1875rem;
  }

  .order {
    position: absolute;
    top: 0;
    left: 2px;
    color: #fff;
    display: flex;
    flex-direction: column;
  }

  .p-4 {
    padding: 0.1rem 0.25rem;
  }

  .fs-10 {
    font-size: 0.625rem;
  }

  .make-money {
    position: relative;
    border-radius: 0.25rem;
    display: flex;
    justify-content: space-between;
    color: #ff7b05;
    border: 1px solid #ff7b05;

    .line {
      position: relative;

      &::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        width: 0.0313rem;
        height: 100%;
        background: #ff7b05;
      }
    }
  }

  .original-cost {
    font-size: 0.75rem;
    color: #999;
    text-decoration: line-through;
  }

  .bold {
    font-weight: bold;
  }

  .mr-16 {
    margin-right: 0.5rem;
  }

  .mr-8 {
    margin-right: 0.25rem;
  }

  .f24 {
    font-size: 0.75rem;
  }

  .c-FF6238 {
    color: #ff6238;
  }

  .fz-24 {
    font-size: 0.75rem;
  }

  .box-item {
    display: flex;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .box-item-right {
    padding-top: 0.5rem;
    flex: 1;
  }

  .box-item-img {
    width: 6.5rem;
    height: 6rem;
    margin-right: 0.5rem;
    position: relative;
    border-radius: 0.25rem;
    overflow: hidden;
  }
}
</style>
